home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / util / libs / zee_inilib.lha / ini_library / include / clib / ini_protos.h
Encoding:
C/C++ Source or Header  |  1999-03-27  |  8.7 KB  |  191 lines

  1. #ifndef  CLIB_INI_PROTOS_H
  2. #define  CLIB_INI_PROTOS_H
  3.  
  4. /*
  5. **    $VER: ini_protos.h 31.00 (16.3.99)
  6. **
  7. **    C prototypes. For use with 32 bit integers only.
  8. **
  9. **      Copyright © 1999 Seasons.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef  EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16. #ifndef  LIBRARIES_INI_LIB_H
  17. #include <libraries/ini_lib.h>
  18. #endif
  19.  
  20. /* Miscellanous functions (mainly for coder support) */
  21. APTR iniAllocPMem( unsigned long byteSize );
  22. void iniFreePMem( APTR memoryBlock, unsigned long byteSize );
  23. STRPTR iniAllocNameStr( STRPTR string );
  24. void iniFreeNameStr( STRPTR namestring );
  25. STRPTR iniSetString( APTR StructPos, STRPTR string );
  26. STRPTR iniSetNameStr( APTR StructPos, STRPTR namestring );
  27.  
  28. /* INI file management */
  29. struct iniFile *iniOpenDefault( APTR address, STRPTR name,
  30.     unsigned long len );
  31. struct iniFile *iniOpenFile( STRPTR name, long accessMode );
  32. struct iniFile *iniOpenFromFH( BPTR fh, unsigned long len );
  33. struct iniFile *iniOpenMem( APTR address, unsigned long len );
  34. void iniClose( struct iniFile *iniFile );
  35. ULONG iniSaveFile( struct iniFile *iniFile, STRPTR name, long accessMode );
  36. ULONG iniSaveToFH( BPTR fh, struct iniFile *iniFile );
  37.  
  38. /* INI file context construction functions */
  39. struct ContextStr *iniCreateContext( STRPTR ContextName );
  40. void iniFreeContext( struct ContextStr *ContextStr );
  41. void iniAddContext( struct iniFile *iniFile, struct ContextStr *ContextStr );
  42. void iniRemContext( struct iniFile *iniFile );
  43. void iniInsertContext( struct iniFile *iniFile, struct ContextStr *ContextStr,
  44.     struct ContextStr *PredContext );
  45. void iniDeleteContext( struct ContextStr *ContextStr );
  46.  
  47. /* INI file context item construction functions */
  48. struct ContextItemLine *iniCreateContextItem( STRPTR CStr );
  49. void iniFreeContextItem( struct ContextItemLine *ContextItemLine );
  50. void iniAddContextItem( struct ContextStr *ContextStr,
  51.     struct ContextItemLine *ContextItemLine );
  52. void iniRemContextItem( struct ContextStr *ContextStr );
  53. void iniInsertContextItem( struct ContextStr *ContextStr,
  54.     struct ContextItemLine *ContextItemLine,
  55.     struct ContextItemLine *PredLine );
  56. void iniDeleteContextItem( struct ContextItemLine *ContextItemLine );
  57.  
  58. /* Evaluating INI context and item fields */
  59. ULONG iniReadLong( struct iniFile *iniFile, STRPTR ContextName,
  60.     STRPTR ItemName, unsigned long Default, unsigned long Flags );
  61. ULONG iniReadFloat( struct iniFile *iniFile, STRPTR ContextName,
  62.     STRPTR ItemName, unsigned long Default, unsigned long Flags );
  63. STRPTR iniReadStr( struct iniFile *iniFile, STRPTR ContextName,
  64.     STRPTR ItemName, STRPTR Default, unsigned long Flags );
  65. BOOL iniReadByteA( struct iniFile *iniFile, STRPTR ContextName,
  66.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  67.     unsigned long Flags );
  68. BOOL iniReadWordA( struct iniFile *iniFile, STRPTR ContextName,
  69.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  70.     unsigned long Flags );
  71. BOOL iniReadLongA( struct iniFile *iniFile, STRPTR ContextName,
  72.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  73.     unsigned long Flags );
  74. BOOL iniReadFloatA( struct iniFile *iniFile, STRPTR ContextName,
  75.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  76.     unsigned long Flags );
  77. BOOL iniReadStrA( struct iniFile *iniFile, STRPTR ContextName,
  78.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  79.     unsigned long Flags );
  80. ULONG iniWriteLong( struct iniFile *iniFile, STRPTR ContextName,
  81.     STRPTR ContextItem, unsigned long Value, unsigned long Flags,
  82.     unsigned long Format, unsigned long Len, unsigned long ZeroSep );
  83. ULONG iniWriteFloat( struct iniFile *iniFile, STRPTR ContextName,
  84.     STRPTR ContextItem, unsigned long Value, unsigned long Flags,
  85.     unsigned long FltFormat, unsigned long IntLen, unsigned long FracLen,
  86.     unsigned long ZeroSep );
  87. ULONG iniWriteStr( struct iniFile *iniFile, STRPTR ContextName,
  88.     STRPTR ContextItem, STRPTR String, unsigned long Flags );
  89. ULONG iniWriteByteA( struct iniFile *iniFile, STRPTR ContextName,
  90.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  91.     unsigned long Flags, unsigned long Format, unsigned long Len,
  92.     unsigned long ZeroSep );
  93. ULONG iniWriteWordA( struct iniFile *iniFile, STRPTR ContextName,
  94.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  95.     unsigned long Flags, unsigned long Format, unsigned long Len,
  96.     unsigned long ZeroSep );
  97. ULONG iniWriteLongA( struct iniFile *iniFile, STRPTR ContextName,
  98.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  99.     unsigned long Flags, unsigned long Format, unsigned long Len,
  100.     unsigned long ZeroSep );
  101. ULONG iniWriteFloatA( struct iniFile *iniFile, STRPTR ContextName,
  102.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  103.     unsigned long Flags, unsigned long FloatFormat, unsigned long IntLen,
  104.     unsigned long FracLen, unsigned long ZeroSep );
  105. ULONG iniWriteStrA( struct iniFile *iniFile, STRPTR ContextName,
  106.     STRPTR ContextItem, APTR Array, unsigned long Entries,
  107.     unsigned long Flags );
  108.  
  109. /* Low level functions (these evaluate single lines) */
  110. STRPTR iniGetContextName( STRPTR ContextLine, APTR Buffer );
  111. STRPTR iniGetContextItem( struct ContextStr *ContextStr,
  112.     struct ContextItemLine *ContextItemLine, APTR Buffer );
  113. STRPTR iniGetContextItemData( struct ContextStr *ContextStr,
  114.     struct ContextItemLine *ContextItemLine, APTR Buffer );
  115. STRPTR iniGetContextItemDataA( struct ContextStr *ContextStr,
  116.     struct ContextItemLine *ContextItemLine, APTR Buffer,
  117.     unsigned long Number );
  118. BOOL iniCheckComment( struct ContextStr *ContextStr,
  119.     struct ContextItemLine *ContextItemLine );
  120. ULONG iniGetNumArrays( struct ContextStr *ContextStr,
  121.     struct ContextItemLine *ContextItemLine );
  122. STRPTR iniGetArrayLine( struct ContextStr *ContextStr,
  123.     struct ContextItemLine *ContextItemLine, unsigned long Number );
  124. STRPTR iniGetArrayPos( struct ContextStr *ContextStr,
  125.     struct ContextItemLine *ContextItemLine, unsigned long Number );
  126. ULONG iniGetLong( struct ContextStr *ContextStr,
  127.     struct ContextItemLine *ContextItemLine, unsigned long Default );
  128. ULONG iniGetFloat( struct ContextStr *ContextStr,
  129.     struct ContextItemLine *ContextItemLine, unsigned long Default );
  130. STRPTR iniGetStr( struct ContextStr *ContextStr,
  131.     struct ContextItemLine *ContextItemLine, STRPTR Default );
  132. ULONG iniGetByteA( struct ContextStr *ContextStr,
  133.     struct ContextItemLine *ContextItemLine, APTR Array,
  134.     unsigned long Entries );
  135. ULONG iniGetWordA( struct ContextStr *ContextStr,
  136.     struct ContextItemLine *ContextItemLine, APTR Array,
  137.     unsigned long Entries );
  138. ULONG iniGetLongA( struct ContextStr *ContextStr,
  139.     struct ContextItemLine *ContextItemLine, APTR Array,
  140.     unsigned long Entries );
  141. ULONG iniGetFloatA( struct ContextStr *ContextStr,
  142.     struct ContextItemLine *ContextItemLine, APTR Array,
  143.     unsigned long Entries );
  144. STRPTR iniGetStrA( struct ContextStr *ContextStr,
  145.     struct ContextItemLine *ContextItemLine, APTR Array,
  146.     unsigned long Entries );
  147. ULONG iniPutLong( struct ContextStr *ContextStr,
  148.     struct ContextItemLine *ContextItemLine, unsigned long Value,
  149.     unsigned long Format, unsigned long Len, unsigned long ZeroSep );
  150. ULONG iniPutFloat( struct ContextStr *ContextStr,
  151.     struct ContextItemLine *ContextItemLine, unsigned long Value,
  152.     unsigned long FltFormat, unsigned long IntLen, unsigned long FracLen,
  153.     unsigned long ZeroSep );
  154. ULONG iniPutStr( struct ContextStr *ContextStr,
  155.     struct ContextItemLine *ContextItemLine, unsigned long Value,
  156.     STRPTR String );
  157. ULONG iniPutByteA( struct ContextStr *ContextStr,
  158.     struct ContextItemLine *ContextItemLine, APTR Array,
  159.     unsigned long Entries, unsigned long Format, unsigned long Len,
  160.     unsigned long ZeroSep );
  161. ULONG iniPutWordA( struct ContextStr *ContextStr,
  162.     struct ContextItemLine *ContextItemLine, APTR Array,
  163.     unsigned long Entries, unsigned long Format, unsigned long Len,
  164.     unsigned long ZeroSep );
  165. ULONG iniPutLongA( struct ContextStr *ContextStr,
  166.     struct ContextItemLine *ContextItemLine, APTR Array,
  167.     unsigned long Entries, unsigned long Format, unsigned long Len,
  168.     unsigned long ZeroSep );
  169. ULONG iniPutFloatA( struct ContextStr *ContextStr,
  170.     struct ContextItemLine *ContextItemLine, APTR Array,
  171.     unsigned long Entries, unsigned long FltFormat, unsigned long IntLen,
  172.     unsigned long FracLen, unsigned long ZeroSep );
  173. ULONG iniPutStrA( struct ContextStr *ContextStr,
  174.     struct ContextItemLine *ContextItemLine, APTR Array,
  175.     unsigned long Entries );
  176. ULONG iniStrToInt( STRPTR String, unsigned long Default );
  177. ULONG iniIntToStr( APTR Buffer, unsigned long Integer,
  178.     unsigned long Format, unsigned long Len, unsigned long ZeroSep );
  179. ULONG iniStrToFloat( STRPTR String, unsigned long Default );
  180. ULONG iniFloatToStr( APTR Buffer, unsigned long Float,
  181.     unsigned long FltFormat, unsigned long IntLen, unsigned long FracLen,
  182.     unsigned long ZeroSep );
  183.  
  184. /* INI scan functions (search for contexts, context items) */
  185. struct ContextStr *iniFindContext( struct iniFile *iniFile,
  186.     STRPTR ContextName, unsigned long Flags );
  187. struct ContextItemLine *iniFindItem( struct ContextStr *ContextStr,
  188.     STRPTR ContextItemName, unsigned long Flags );
  189.  
  190. #endif     /* CLIB_INI_PROTOS_H */
  191.